---------------------------------------------------------------
-- @Description：         common
---------------------------------------------------------------
local skynet = require "skynet"
local log = require "sky_log"
local cc = require "sky_call"
local CMD = require "cmds"
local packetbase = require "lua_packetbase"
local socket = require "skynet.socket"
local M = {}

local function send_msg(fd, msg, size)
    socket.write(fd, msg, size)
end

--发表情
M.do_send_expression = function (fd, tid, seat_id, id)
    local write_pack = packetbase.create_writebase()
    write_pack:write_begin(CMD.CLIENT_COMMAND_USER_FROMTOCHIPS)
    write_pack:write_int(tid)
    write_pack:write_byte(seat_id)
    write_pack:write_int(id)
    write_pack:write_int64(0)
    write_pack:write_byte(3)
    write_pack:write_end()

    local index = math.random(1, 600)
    skynet.sleep(index)

    local msg, size = write_pack:return_buf()
    send_msg(fd, msg, size)
end


return M